<?php
declare(strict_types=1);

namespace app\admin\service;

use app\admin\model\Location as LocationModel;

class LocationService
{
    /**
     * 获取省
     * @return array|\think\Collection
     * @throws \think\db\exception\DataNotFoundException
     * @throws \think\db\exception\DbException
     * @throws \think\db\exception\ModelNotFoundException
     */
    public static function getProvince()
    {
        return LocationModel::getProvince();
    }

    /**
     * 获取市
     * @param $pid
     * @return array|\think\Collection
     * @throws \think\db\exception\DataNotFoundException
     * @throws \think\db\exception\DbException
     * @throws \think\db\exception\ModelNotFoundException
     */
    public static function getCity($pid)
    {
        return LocationModel::getCity($pid);
    }

    /**
     * 获取区
     * @param $pid
     * @return array|\think\Collection
     * @throws \think\db\exception\DataNotFoundException
     * @throws \think\db\exception\DbException
     * @throws \think\db\exception\ModelNotFoundException
     */
    public static function getArea($pid)
    {
        return LocationModel::getArea($pid);
    }

    /**
     * 获取位置值
     * @param $where
     * @return mixed
     */
    public static function getLocationValue($where)
    {
        return LocationModel::getLocationValue($where);
    }
}